<?php

/**
 * GlOrderDetails filter form base class.
 *
 * @package    GREEN_LIGHT
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseGlOrderDetailsFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'order_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('GlOrder'), 'add_empty' => true)),
      'user_id'           => new sfWidgetFormFilterInput(),
      'card_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('GlCard'), 'add_empty' => true)),
      'card_name'         => new sfWidgetFormFilterInput(),
      'card_quantity'     => new sfWidgetFormFilterInput(),
      'total_amount'      => new sfWidgetFormFilterInput(),
      'discount_percent'  => new sfWidgetFormFilterInput(),
      'total_real_amount' => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'order_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('GlOrder'), 'column' => 'order_id')),
      'user_id'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'card_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('GlCard'), 'column' => 'card_id')),
      'card_name'         => new sfValidatorPass(array('required' => false)),
      'card_quantity'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'total_amount'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'discount_percent'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'total_real_amount' => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('gl_order_details_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'GlOrderDetails';
  }

  public function getFields()
  {
    return array(
      'order_details_id'  => 'Number',
      'order_id'          => 'ForeignKey',
      'user_id'           => 'Number',
      'card_id'           => 'ForeignKey',
      'card_name'         => 'Text',
      'card_quantity'     => 'Number',
      'total_amount'      => 'Number',
      'discount_percent'  => 'Number',
      'total_real_amount' => 'Text',
    );
  }
}
